const http = require("http");
const fs = require("fs");
const path = require("path");

 http.createServer((req,res)=>{
    /**同步的读取文件内容，读取完成后进行后续操做 */
    let filepath = path.join(__dirname,"2.png")
    let buf = fs.readFileSync(filepath);
    buf = buf.toString("base64");
    let imageDate ="data:image/png;base64,"+buf;
   let htmlContent = "<!DOCTYPE html>"+
        "<head></head>"+
        "<body>"+
        "<img src='https://gitee.com/static/images/logo-black.svg?t=158106664'>"+
        "</body>"+
   "</html>";
    res.end("htmlContent");

 }).listen(8080);
 console.log("server is listening 8080");



